package com.example.music.controller;

import com.example.music.utils.WebCrossOriginTest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @className: WebServer
 * @author: gremlin
 * @version: 1.0.0
 * @description:
 * @date: 2022/3/25 9:33
 */
@RestController
public class WebServer {

    /**
     * 不使用手写注解 error出现web跨域问题
     * @return
     */
    @RequestMapping("/geyChen1")
    public HashMap<String,String> webCross1(){
        HashMap<String, String> stringStringHashMap = new HashMap<>();
        stringStringHashMap.put("msg","success");
        return stringStringHashMap;
    }

    /**
     * 使用手写注解 success解决web跨域问题
     * @return
     */
    @RequestMapping("/geyChen")
    @WebCrossOriginTest()
    public HashMap<String,String> webCross(){
        HashMap<String, String> stringStringHashMap = new HashMap<>();
        stringStringHashMap.put("msg","success");
        return stringStringHashMap;
    }
}
